/*
 * Copyright 2008 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.ccsoft.mc.core;
/**
 * 
 * @author Chao Cai
 * 
 * The reference of the component using to express the dependency on other service 
 */
public class Reference {

	public Reference() {
		super();
		// TODO Auto-generated constructor stub
	}
	private String interfaceName;
	private String componentName;
	private String property;
	private int cardinalityMin=1;
	private int cardinalityMax=1;
	public int getCardinalityMax() {
		return cardinalityMax;
	}

	public void setCardinalityMax(int cardinalityMax) {
		this.cardinalityMax = cardinalityMax;
	}

	public int getCardinalityMin() {
		return cardinalityMin;
	}

	public void setCardinalityMin(int cardinalityMin) {
		this.cardinalityMin = cardinalityMin;
	}

	public String getComponentName() {
		return componentName;
	}

	public void setComponentName(String componentName) {
		this.componentName = componentName;
	}

	public String getInterfaceName() {
		return interfaceName;
	}

	public void setInterfaceName(String interfaceName) {
		this.interfaceName = interfaceName;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Service){
			if(((Reference)obj).getInterfaceName().equals(this.interfaceName)){
				return true;
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		return this.interfaceName.hashCode();
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String property) {
		this.property = property;
	}
	
}
